using System;
using System.Linq;
using System.Runtime.Serialization;
using System.Xml.Serialization;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using Widgetsphere.Autos.EFDAL;
using System.Text.RegularExpressions;
using System.Linq.Expressions;
using System.Data.Entity;
using System.Data.Linq;
using System.Data.Entity.ModelConfiguration;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.Core.Objects.DataClasses;

namespace Widgetsphere.Autos.EFDAL.Entity
{
	/// <summary>
	/// The collection to hold 'Dealer' entities
	/// </summary>
	[DataContract]
	[Serializable]
	[System.Data.Linq.Mapping.Table(Name = "Dealer")]
	[System.CodeDom.Compiler.GeneratedCode("nHydrateModelGenerator", "5.3.0")]
	[EdmEntityTypeAttribute(NamespaceName = "Widgetsphere.Autos.EFDAL.Entity", Name = "Dealer")]
	[nHydrate.EFCore.Attributes.FieldNameConstantsAttribute(typeof(Widgetsphere.Autos.EFDAL.Entity.Dealer.FieldNameConstants))]
	[System.ComponentModel.DataAnnotations.MetadataType(typeof(Widgetsphere.Autos.EFDAL.Interfaces.Entity.Metadata.DealerMetadata))]
	[nHydrate.EFCore.Attributes.EntityMetadata("Dealer", false, true, true, true, "", true, false, false, "dbo")]
	public partial class Dealer : Widgetsphere.Autos.EFDAL.Entity.UserAccount, nHydrate.EFCore.DataAccess.IBusinessObject, Widgetsphere.Autos.EFDAL.IEntityWithContext, System.ComponentModel.IDataErrorInfo, Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer, System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer>, nHydrate.EFCore.DataAccess.IAuditable
	{
		#region FieldNameConstants Enumeration

		/// <summary>
		/// Enumeration to define each property that maps to a database field for the 'Dealer' table.
		/// </summary>
		public new enum FieldNameConstants
		{
			/// <summary>
			/// Field mapping for the 'AcceptedAdvertTerms' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'AcceptedAdvertTerms' property")]
			AcceptedAdvertTerms,
			/// <summary>
			/// Field mapping for the 'Active' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Active' property")]
			Active,
			/// <summary>
			/// Field mapping for the 'Address1' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Address1' property")]
			Address1,
			/// <summary>
			/// Field mapping for the 'Address2' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Address2' property")]
			Address2,
			/// <summary>
			/// Field mapping for the 'AlertFrequency' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'AlertFrequency' property")]
			AlertFrequency,
			/// <summary>
			/// Field mapping for the 'AlertSent' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'AlertSent' property")]
			AlertSent,
			/// <summary>
			/// Field mapping for the 'City' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'City' property")]
			City,
			/// <summary>
			/// Field mapping for the 'CompanyName' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'CompanyName' property")]
			CompanyName,
			/// <summary>
			/// Field mapping for the 'Description' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Description' property")]
			Description,
			/// <summary>
			/// Field mapping for the 'Directions' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Directions' property")]
			Directions,
			/// <summary>
			/// Field mapping for the 'Email' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Email' property")]
			Email,
			/// <summary>
			/// Field mapping for the 'FirstName' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'FirstName' property")]
			FirstName,
			/// <summary>
			/// Field mapping for the 'HomePhone' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'HomePhone' property")]
			HomePhone,
			/// <summary>
			/// Field mapping for the 'LastName' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'LastName' property")]
			LastName,
			/// <summary>
			/// Field mapping for the 'Latitude' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Latitude' property")]
			Latitude,
			/// <summary>
			/// Field mapping for the 'Longitude' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Longitude' property")]
			Longitude,
			/// <summary>
			/// Field mapping for the 'MetroId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'MetroId' property")]
			MetroId,
			/// <summary>
			/// Field mapping for the 'MobilePhone' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'MobilePhone' property")]
			MobilePhone,
			/// <summary>
			/// Field mapping for the 'OfficeFax' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'OfficeFax' property")]
			OfficeFax,
			/// <summary>
			/// Field mapping for the 'OfficePhone' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'OfficePhone' property")]
			OfficePhone,
			/// <summary>
			/// Field mapping for the 'OfficePhoneExt' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'OfficePhoneExt' property")]
			OfficePhoneExt,
			/// <summary>
			/// Field mapping for the 'Password' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'Password' property")]
			Password,
			/// <summary>
			/// Field mapping for the 'StateId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'StateId' property")]
			StateId,
			/// <summary>
			/// Field mapping for the 'UserId' property
			/// </summary>
			[nHydrate.EFCore.Attributes.PrimaryKeyAttribute()]
			[System.ComponentModel.ReadOnlyAttribute(true)]
			[System.ComponentModel.Description("Field mapping for the 'UserId' property")]
			UserId,
			/// <summary>
			/// Field mapping for the 'UserTypeId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'UserTypeId' property")]
			UserTypeId,
			/// <summary>
			/// Field mapping for the 'ZipId' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ZipId' property")]
			ZipId,
			/// <summary>
			/// Field mapping for the 'CreatedBy' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'CreatedBy' property")]
			CreatedBy,
			/// <summary>
			/// Field mapping for the 'CreatedDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'CreatedDate' property")]
			CreatedDate,
			/// <summary>
			/// Field mapping for the 'ModifiedBy' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ModifiedBy' property")]
			ModifiedBy,
			/// <summary>
			/// Field mapping for the 'ModifiedDate' property
			/// </summary>
			[System.ComponentModel.Description("Field mapping for the 'ModifiedDate' property")]
			ModifiedDate,
		}
		#endregion

		#region Constructors

		/// <summary>
		/// Initializes a new instance of the Widgetsphere.Autos.EFDAL.Entity.Dealer class
		/// </summary>
		public Dealer()
		{

		}

		/// <summary>
		/// Initializes a new instance of the Widgetsphere.Autos.EFDAL.Entity.Dealer class with a defined primary key
		/// </summary>
		public Dealer(int userId)
			: this()
		{
			this.UserId = userId;
		}

		#endregion

		#region Properties

		/// <summary>
		/// The property that maps back to the database 'Dealer.CompanyName' field.
		/// </summary>
		/// <remarks>Field: [Dealer].[CompanyName], Field Length: 50, Not Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = false)]
		[System.ComponentModel.DisplayName("CompanyName")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(50)]
		public virtual string CompanyName
		{
			get { return _companyName; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "CompanyName");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_companyName = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("CompanyName"));
			}
		}

		/// <summary>
		/// Driving direction to the Dealer
		/// </summary>
		/// <remarks>Field: [Dealer].[Directions], Field Length: 500, Nullable</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("Directions")]
		[System.ComponentModel.Description("Driving direction to the Dealer")]
		[System.Diagnostics.DebuggerNonUserCode]
		[StringLength(500)]
		public virtual string Directions
		{
			get { return _directions; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<string>(value, "Directions");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_directions = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("Directions"));
			}
		}

		/// <summary>
		/// The property that maps back to the database 'Dealer.MetroId' field.
		/// </summary>
		/// <remarks>Field: [Dealer].[MetroId], Nullable, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = false, IsNullable = true)]
		[System.ComponentModel.DisplayName("MetroId")]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int? MetroId
		{
			get { return _metroId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int?>(value, "MetroId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_metroId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("MetroId"));
			}
		}

		/// </summary>
		/// <remarks>Field: [Dealer].[UserId], Not Nullable, Primary Key, Unique, Indexed</remarks>
		[DataMember]
		[System.ComponentModel.Browsable(true)]
		[EdmScalarPropertyAttribute(EntityKeyProperty = true, IsNullable = false)]
		[System.ComponentModel.DisplayName("UserId")]
		[System.ComponentModel.DataAnnotations.Key()]
		[System.ComponentModel.ReadOnly(true)]
		[System.Diagnostics.DebuggerNonUserCode]
		public virtual int UserId
		{
			get { return _userId; }
			set
			{
				var eventArg = new nHydrate.EFCore.EventArgs.ChangingEventArgs<int>(value, "UserId");
				this.OnPropertyChanging(eventArg);
				if (eventArg.Cancel) return;
				_userId = eventArg.Value;
				this.OnPropertyChanged(new PropertyChangedEventArgs("UserId"));
			}
		}

		#endregion

		#region Property Holders

		/// <summary />
		protected string _companyName;
		/// <summary />
		protected string _directions;
		/// <summary />
		protected int? _metroId;

		#endregion

		#region GetMaxLength

		/// <summary>
		/// Gets the maximum size of the field value.
		/// </summary>
		public static int GetMaxLength(FieldNameConstants field)
		{
			switch (field)
			{
				case FieldNameConstants.AcceptedAdvertTerms:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.AcceptedAdvertTerms);
				case FieldNameConstants.Active:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Active);
				case FieldNameConstants.Address1:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Address1);
				case FieldNameConstants.Address2:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Address2);
				case FieldNameConstants.AlertFrequency:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.AlertFrequency);
				case FieldNameConstants.AlertSent:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.AlertSent);
				case FieldNameConstants.City:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.City);
				case FieldNameConstants.CompanyName:
					return 50;
				case FieldNameConstants.Description:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Description);
				case FieldNameConstants.Directions:
					return 500;
				case FieldNameConstants.Email:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Email);
				case FieldNameConstants.FirstName:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.FirstName);
				case FieldNameConstants.HomePhone:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.HomePhone);
				case FieldNameConstants.LastName:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.LastName);
				case FieldNameConstants.Latitude:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Latitude);
				case FieldNameConstants.Longitude:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Longitude);
				case FieldNameConstants.MetroId:
					return 0;
				case FieldNameConstants.MobilePhone:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.MobilePhone);
				case FieldNameConstants.OfficeFax:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.OfficeFax);
				case FieldNameConstants.OfficePhone:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.OfficePhone);
				case FieldNameConstants.OfficePhoneExt:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.OfficePhoneExt);
				case FieldNameConstants.Password:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.Password);
				case FieldNameConstants.StateId:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.StateId);
				case FieldNameConstants.UserId:
					return 0;
				case FieldNameConstants.UserTypeId:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.UserTypeId);
				case FieldNameConstants.ZipId:
					return UserAccount.GetMaxLength(UserAccount.FieldNameConstants.ZipId);
			}
			return 0;
		}

		int nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetMaxLength(Enum field)
		{
			return GetMaxLength((FieldNameConstants)field);
		}

		#endregion

		#region GetFieldNameConstants

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldNameConstants()
		{
			return typeof(FieldNameConstants);
		}

		#endregion

		#region GetFieldType

		/// <summary>
		/// Gets the system type of a field on this object
		/// </summary>
		public static System.Type GetFieldType(FieldNameConstants field)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type 'Widgetsphere.Autos.EFDAL.Entity.Dealer.FieldNameConstants'.");

			switch ((FieldNameConstants)field)
			{
				case FieldNameConstants.AcceptedAdvertTerms: return typeof(bool);
				case FieldNameConstants.Active: return typeof(bool);
				case FieldNameConstants.Address1: return typeof(string);
				case FieldNameConstants.Address2: return typeof(string);
				case FieldNameConstants.AlertFrequency: return typeof(int);
				case FieldNameConstants.AlertSent: return typeof(DateTime?);
				case FieldNameConstants.City: return typeof(string);
				case FieldNameConstants.CompanyName: return typeof(string);
				case FieldNameConstants.Description: return typeof(string);
				case FieldNameConstants.Directions: return typeof(string);
				case FieldNameConstants.Email: return typeof(string);
				case FieldNameConstants.FirstName: return typeof(string);
				case FieldNameConstants.HomePhone: return typeof(string);
				case FieldNameConstants.LastName: return typeof(string);
				case FieldNameConstants.Latitude: return typeof(double?);
				case FieldNameConstants.Longitude: return typeof(double?);
				case FieldNameConstants.MetroId: return typeof(int?);
				case FieldNameConstants.MobilePhone: return typeof(string);
				case FieldNameConstants.OfficeFax: return typeof(string);
				case FieldNameConstants.OfficePhone: return typeof(string);
				case FieldNameConstants.OfficePhoneExt: return typeof(string);
				case FieldNameConstants.Password: return typeof(string);
				case FieldNameConstants.StateId: return typeof(int);
				case FieldNameConstants.UserId: return typeof(int);
				case FieldNameConstants.UserTypeId: return typeof(int);
				case FieldNameConstants.ZipId: return typeof(int?);
			}
			return null;
		}

		System.Type nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetFieldType(Enum field)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type 'Widgetsphere.Autos.EFDAL.Entity.Dealer.FieldNameConstants'.");

			return GetFieldType((Widgetsphere.Autos.EFDAL.Entity.Dealer.FieldNameConstants)field);
		}

		#endregion

		#region Get/Set Value

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field)
		{
			return ((nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject)this).GetValue(field, null);
		}

		object nHydrate.EFCore.DataAccess.IReadOnlyBusinessObject.GetValue(System.Enum field, object defaultValue)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");
			return this.GetValue((FieldNameConstants)field, defaultValue);
		}

		void nHydrate.EFCore.DataAccess.IBusinessObject.SetValue(System.Enum field, object newValue)
		{
			if (field.GetType() != typeof(FieldNameConstants))
				throw new Exception("The '" + field.GetType().ReflectedType.ToString() + ".FieldNameConstants' value is not valid. The field parameter must be of type '" + this.GetType().ToString() + ".FieldNameConstants'.");
			this.SetValue((FieldNameConstants)field, newValue);
		}

		#endregion

		#region Clone

		/// <summary>
		/// Creates a shallow copy of this object
		/// </summary>
		public new object Clone()
		{
			return Widgetsphere.Autos.EFDAL.Entity.Dealer.Clone(this);
		}

		/// <summary>
		/// Creates a shallow copy of this object with defined, default values and new PK
		/// </summary>
		public new object CloneAsNew()
		{
			var item = Widgetsphere.Autos.EFDAL.Entity.Dealer.Clone(this);
			return item;
		}

		/// <summary>
		/// Creates a shallow copy of this object
		/// </summary>
		public static Dealer Clone(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer item)
		{
			var newItem = new Dealer();
			newItem.AcceptedAdvertTerms = item.AcceptedAdvertTerms;
			newItem.Active = item.Active;
			newItem.Address1 = item.Address1;
			newItem.Address2 = item.Address2;
			newItem.AlertFrequency = item.AlertFrequency;
			newItem.AlertSent = item.AlertSent;
			newItem.City = item.City;
			newItem.CompanyName = item.CompanyName;
			newItem.Description = item.Description;
			newItem.Directions = item.Directions;
			newItem.Email = item.Email;
			newItem.FirstName = item.FirstName;
			newItem.HomePhone = item.HomePhone;
			newItem.LastName = item.LastName;
			newItem.Latitude = item.Latitude;
			newItem.Longitude = item.Longitude;
			newItem.MetroId = item.MetroId;
			newItem.MobilePhone = item.MobilePhone;
			newItem.OfficeFax = item.OfficeFax;
			newItem.OfficePhone = item.OfficePhone;
			newItem.OfficePhoneExt = item.OfficePhoneExt;
			newItem.Password = item.Password;
			newItem.StateId = item.StateId;
			newItem.UserId = item.UserId;
			newItem.UserTypeId = item.UserTypeId;
			newItem.ZipId = item.ZipId;
			newItem.CreatedDate = item.CreatedDate;
			newItem.CreatedBy = item.CreatedBy;
			newItem.ModifiedDate = item.ModifiedDate;
			newItem.ModifiedBy = item.ModifiedBy;
			return newItem;
		}

		#endregion

		#region IsEquivalent

		/// <summary>
		/// Determines if all of the fields for the specified object exactly matches the current object.
		/// </summary>
		/// <param name="item">The object to compare</param>
		public override bool IsEquivalent(nHydrate.EFCore.DataAccess.INHEntityObject item)
		{
			return ((System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer>)this).Equals(item as Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer);
		}

		#endregion

		#region GetValue

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field)
		{
			return GetValue(field, null);
		}

		/// <summary>
		/// Gets the value of one of this object's properties.
		/// </summary>
		public object GetValue(FieldNameConstants field, object defaultValue)
		{
			if (field == FieldNameConstants.AcceptedAdvertTerms)
				return this.AcceptedAdvertTerms;
			if (field == FieldNameConstants.Active)
				return this.Active;
			if (field == FieldNameConstants.Address1)
				return ((this.Address1 == null) ? defaultValue : this.Address1);
			if (field == FieldNameConstants.Address2)
				return ((this.Address2 == null) ? defaultValue : this.Address2);
			if (field == FieldNameConstants.AlertFrequency)
				return this.AlertFrequency;
			if (field == FieldNameConstants.AlertSent)
				return ((this.AlertSent == null) ? defaultValue : this.AlertSent);
			if (field == FieldNameConstants.City)
				return ((this.City == null) ? defaultValue : this.City);
			if (field == FieldNameConstants.CompanyName)
				return this.CompanyName;
			if (field == FieldNameConstants.Description)
				return ((this.Description == null) ? defaultValue : this.Description);
			if (field == FieldNameConstants.Directions)
				return ((this.Directions == null) ? defaultValue : this.Directions);
			if (field == FieldNameConstants.Email)
				return this.Email;
			if (field == FieldNameConstants.FirstName)
				return this.FirstName;
			if (field == FieldNameConstants.HomePhone)
				return ((this.HomePhone == null) ? defaultValue : this.HomePhone);
			if (field == FieldNameConstants.LastName)
				return this.LastName;
			if (field == FieldNameConstants.Latitude)
				return ((this.Latitude == null) ? defaultValue : this.Latitude);
			if (field == FieldNameConstants.Longitude)
				return ((this.Longitude == null) ? defaultValue : this.Longitude);
			if (field == FieldNameConstants.MetroId)
				return ((this.MetroId == null) ? defaultValue : this.MetroId);
			if (field == FieldNameConstants.MobilePhone)
				return ((this.MobilePhone == null) ? defaultValue : this.MobilePhone);
			if (field == FieldNameConstants.OfficeFax)
				return ((this.OfficeFax == null) ? defaultValue : this.OfficeFax);
			if (field == FieldNameConstants.OfficePhone)
				return ((this.OfficePhone == null) ? defaultValue : this.OfficePhone);
			if (field == FieldNameConstants.OfficePhoneExt)
				return ((this.OfficePhoneExt == null) ? defaultValue : this.OfficePhoneExt);
			if (field == FieldNameConstants.Password)
				return this.Password;
			if (field == FieldNameConstants.StateId)
				return this.StateId;
			if (field == FieldNameConstants.UserId)
				return this.UserId;
			if (field == FieldNameConstants.UserTypeId)
				return this.UserTypeId;
			if (field == FieldNameConstants.ZipId)
				return ((this.ZipId == null) ? defaultValue : this.ZipId);
			if (field == FieldNameConstants.CreatedBy)
				return ((this.CreatedBy == null) ? defaultValue : this.CreatedBy);
			if (field == FieldNameConstants.CreatedDate)
				return ((this.CreatedDate == null) ? defaultValue : this.CreatedDate);
			if (field == FieldNameConstants.ModifiedBy)
				return ((this.ModifiedBy == null) ? defaultValue : this.ModifiedBy);
			if (field == FieldNameConstants.ModifiedDate)
				return ((this.ModifiedDate == null) ? defaultValue : this.ModifiedDate);
			throw new Exception("Field '" + field.ToString() + "' not found!");
		}

		#endregion

		#region SetValue

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="field">The field to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		public virtual void SetValue(FieldNameConstants field, object newValue)
		{
			SetValue(field, newValue, false);
		}

		/// <summary>
		/// Assigns a value to a field on this object.
		/// </summary>
		/// <param name="field">The field to set</param>
		/// <param name="newValue">The new value to assign to the field</param>
		/// <param name="fixLength">Determines if the length should be truncated if too long. When false, an error will be raised if data is too large to be assigned to the field.</param>
		public virtual void SetValue(FieldNameConstants field, object newValue, bool fixLength)
		{
			if (field == FieldNameConstants.AcceptedAdvertTerms)
			{
				this.AcceptedAdvertTerms = GlobalValues.SetValueHelperBoolNotNullableInternal(newValue, "Field 'AcceptedAdvertTerms' does not allow null values!");
			}
			else if (field == FieldNameConstants.Active)
			{
				this.Active = GlobalValues.SetValueHelperBoolNotNullableInternal(newValue, "Field 'Active' does not allow null values!");
			}
			else if (field == FieldNameConstants.Address1)
			{
				this.Address1 = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Address2)
			{
				this.Address2 = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.AlertFrequency)
			{
				this.AlertFrequency = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'AlertFrequency' does not allow null values!");
			}
			else if (field == FieldNameConstants.AlertSent)
			{
				this.AlertSent = GlobalValues.SetValueHelperDateTimeNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.City)
			{
				this.City = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.CompanyName)
			{
				this.CompanyName = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Description)
			{
				this.Description = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Directions)
			{
				this.Directions = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Email)
			{
				this.Email = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.FirstName)
			{
				this.FirstName = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.HomePhone)
			{
				this.HomePhone = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.LastName)
			{
				this.LastName = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Latitude)
			{
				this.Latitude = GlobalValues.SetValueHelperDoubleNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.Longitude)
			{
				this.Longitude = GlobalValues.SetValueHelperDoubleNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.MetroId)
			{
				this.MetroId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else if (field == FieldNameConstants.MobilePhone)
			{
				this.MobilePhone = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.OfficeFax)
			{
				this.OfficeFax = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.OfficePhone)
			{
				this.OfficePhone = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.OfficePhoneExt)
			{
				this.OfficePhoneExt = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.Password)
			{
				this.Password = GlobalValues.SetValueHelperInternal((string)newValue, fixLength, GetMaxLength(field));
			}
			else if (field == FieldNameConstants.StateId)
			{
				this.StateId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'StateId' does not allow null values!");
			}
			else if (field == FieldNameConstants.UserId)
			{
				throw new Exception("Field '" + field.ToString() + "' is a primary key and cannot be set!");
			}
			else if (field == FieldNameConstants.UserTypeId)
			{
				this.UserTypeId = GlobalValues.SetValueHelperIntNotNullableInternal(newValue, "Field 'UserTypeId' does not allow null values!");
			}
			else if (field == FieldNameConstants.ZipId)
			{
				this.ZipId = GlobalValues.SetValueHelperIntNullableInternal(newValue);
			}
			else
				throw new Exception("Field '" + field.ToString() + "' not found!");
		}

		#endregion

		#region Navigation Properties

		/// <summary>
		/// The navigation definition for walking Metro->Dealer
		/// </summary>
		[DataMember]
		public virtual Metro Metro { get; set; }

		Widgetsphere.Autos.EFDAL.Interfaces.Entity.IMetro Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer.Metro
		{
			get { return this.Metro; }
			set { this.Metro = (Widgetsphere.Autos.EFDAL.Entity.Metro)value; }
		}

		#endregion

		#region Static SQL Methods

		internal new static string GetFieldAliasFromFieldNameSqlMapping(string alias)
		{
			alias = alias.Replace("[", string.Empty).Replace("]", string.Empty);
			switch (alias.ToLower())
			{
				case "acceptedadvertterms": return "acceptedadvertterms";
				case "active": return "active";
				case "address1": return "address1";
				case "address2": return "address2";
				case "alertfrequency": return "alertfrequency";
				case "alertsent": return "alertsent";
				case "city": return "city";
				case "companyname": return "companyname";
				case "description": return "description";
				case "directions": return "directions";
				case "email": return "email";
				case "firstname": return "firstname";
				case "homephone": return "homephone";
				case "lastname": return "lastname";
				case "latitude": return "latitude";
				case "longitude": return "longitude";
				case "metroid": return "metroid";
				case "mobilephone": return "mobilephone";
				case "officefax": return "officefax";
				case "officephone": return "officephone";
				case "officephoneext": return "officephoneext";
				case "password": return "password";
				case "stateid": return "stateid";
				case "userid": return "userid";
				case "usertypeid": return "usertypeid";
				case "zipid": return "zipid";
				case "createddate": return "createddate";
				case "createdby": return "createdby";
				case "modifieddate": return "modifieddate";
				case "modifiedby": return "modifiedby";
				case "timestamp": return "timestamp";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal new static string GetTableFromFieldAliasSqlMapping(string alias)
		{
			switch (alias.ToLower())
			{
				case "acceptedadvertterms": return "UserAccount";
				case "active": return "UserAccount";
				case "address1": return "UserAccount";
				case "address2": return "UserAccount";
				case "alertfrequency": return "UserAccount";
				case "alertsent": return "UserAccount";
				case "city": return "UserAccount";
				case "companyname": return "Dealer";
				case "description": return "UserAccount";
				case "directions": return "Dealer";
				case "email": return "UserAccount";
				case "firstname": return "UserAccount";
				case "homephone": return "UserAccount";
				case "lastname": return "UserAccount";
				case "latitude": return "UserAccount";
				case "longitude": return "UserAccount";
				case "metroid": return "Dealer";
				case "mobilephone": return "UserAccount";
				case "officefax": return "UserAccount";
				case "officephone": return "UserAccount";
				case "officephoneext": return "UserAccount";
				case "password": return "UserAccount";
				case "stateid": return "UserAccount";
				case "userid": return "Dealer";
				case "usertypeid": return "UserAccount";
				case "zipid": return "UserAccount";
				case "createdby": return "Dealer";
				case "createddate": return "Dealer";
				case "modifiedby": return "Dealer";
				case "modifieddate": return "Dealer";
				case "timestamp": return "Dealer";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal new static string GetTableFromFieldNameSqlMapping(string field)
		{
			switch (field.ToLower())
			{
				case "acceptedadvertterms": return "UserAccount";
				case "active": return "UserAccount";
				case "address1": return "UserAccount";
				case "address2": return "UserAccount";
				case "alertfrequency": return "UserAccount";
				case "alertsent": return "UserAccount";
				case "city": return "UserAccount";
				case "companyname": return "Dealer";
				case "description": return "UserAccount";
				case "directions": return "Dealer";
				case "email": return "UserAccount";
				case "firstname": return "UserAccount";
				case "homephone": return "UserAccount";
				case "lastname": return "UserAccount";
				case "latitude": return "UserAccount";
				case "longitude": return "UserAccount";
				case "metroid": return "Dealer";
				case "mobilephone": return "UserAccount";
				case "officefax": return "UserAccount";
				case "officephone": return "UserAccount";
				case "officephoneext": return "UserAccount";
				case "password": return "UserAccount";
				case "stateid": return "UserAccount";
				case "userid": return "Dealer";
				case "usertypeid": return "UserAccount";
				case "zipid": return "UserAccount";
				case "createdby": return "Dealer";
				case "createddate": return "Dealer";
				case "modifiedby": return "Dealer";
				case "modifieddate": return "Dealer";
				case "timestamp": return "Dealer";
				default: throw new Exception("The select clause is not valid.");
			}
		}

		internal new static string GetRemappedLinqSql(string sql, string parentAlias, LinqSQLFromClauseCollection childTables)
		{
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[acceptedadvertterms\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[acceptedadvertterms]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[active\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[active]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[address1\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[address1]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[address2\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[address2]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[alertfrequency\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[alertfrequency]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[alertsent\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[alertsent]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[city\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[city]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[companyname\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[companyname]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[description\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[description]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[directions\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[directions]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[email\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[email]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[firstname\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[firstname]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[homephone\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[homephone]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[lastname\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[lastname]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[latitude\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[latitude]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[longitude\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[longitude]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[metroid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[metroid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[mobilephone\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[mobilephone]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[officefax\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[officefax]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[officephone\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[officephone]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[officephoneext\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[officephoneext]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[password\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[password]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[stateid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[stateid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[userid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[userid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[usertypeid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[usertypeid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[zipid\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "UserAccount") + "].[zipid]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createdby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[createdby]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[createddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[createddate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifiedby\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[modifiedby]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[modifieddate\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[modifieddate]", RegexOptions.IgnoreCase);
			sql = System.Text.RegularExpressions.Regex.Replace(sql, "\\[" + parentAlias + "\\]\\.\\[timestamp\\]", "[" + childTables.GetBaseAliasTable(parentAlias, "Dealer") + "].[timestamp]", RegexOptions.IgnoreCase);
			return sql;
		}

		#endregion

		#region DeleteData

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where)
		{
			return DeleteData(where, new nHydrate.EFCore.DataAccess.QueryOptimizer(), new ContextStartup(null), Widgetsphere.Autos.EFDAL.AutosEntities.GetConnectionString());
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="optimizer">The optimization object to use for running queries</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, nHydrate.EFCore.DataAccess.QueryOptimizer optimizer)
		{
			return DeleteData(where, optimizer, new ContextStartup(null), Widgetsphere.Autos.EFDAL.AutosEntities.GetConnectionString());
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="connectionString">The database connection string to use for this access</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, string connectionString)
		{
			return DeleteData(where, new nHydrate.EFCore.DataAccess.QueryOptimizer(), new ContextStartup(null), connectionString);
		}

		/// <summary>
		/// Delete all records that match a where condition
		/// </summary>
		/// <param name="where">The expression that determines the records deleted</param>
		/// <param name="optimizer">The optimization object to use for running queries</param>
		/// <param name="startup">The startup options</param>
		/// <param name="connectionString">The database connection string to use for this access</param>
		/// <returns>The number of rows deleted</returns>
		public static int DeleteData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, nHydrate.EFCore.DataAccess.QueryOptimizer optimizer, ContextStartup startup, string connectionString)
		{
			if (optimizer == null)
				optimizer = new nHydrate.EFCore.DataAccess.QueryOptimizer();
				if (startup == null) startup = new ContextStartup(null);

			using (var connection = Widgetsphere.Autos.EFDAL.DBHelper.GetConnection(Widgetsphere.Autos.EFDAL.Util.StripEFCS2Normal(connectionString)))
			{
				using (var dc = new DataContext(connection))
				{
					var template = dc.GetTable<Widgetsphere.Autos.EFDAL.DealerQuery>();
					using (var cmd = nHydrate.EFCore.DataAccess.BusinessEntityQuery.GetCommand<Widgetsphere.Autos.EFDAL.DealerQuery>(dc, template, where))
					{
						if (startup.CommandTimeout != null && startup.CommandTimeout > 0) cmd.CommandTimeout = startup.CommandTimeout.Value;
						else cmd.CommandTimeout = 30;

						var parser = LinqSQLParser.Create(cmd.CommandText, LinqSQLParser.ObjectTypeConstants.Table);
						var sql = "CREATE TABLE #t ([UserId] [Int])";
						sql += "INSERT INTO #t ([UserId])";
						sql += "SELECT [t0].[UserId] #t\r\n";
						sql += parser.GetFromClause(optimizer) + "\r\n";
						sql += parser.GetWhereClause();
						sql += "\r\n";

						var noLock = string.Empty;
						noLock = (optimizer.NoLocking ? "WITH (NOLOCK) " : string.Empty);
						sql += "DELETE [Dealer] FROM [dbo].[Dealer] " + noLock + "INNER JOIN #t ON [dbo].[Dealer].[UserId] = #t.[UserId]\r\n";
						noLock = (optimizer.NoLocking ? "WITH (NOLOCK) " : string.Empty);
						sql += "DELETE [UserAccount] FROM [dbo].[UserAccount] " + noLock + "INNER JOIN #t ON [dbo].[UserAccount].[UserId] = #t.[UserId]\r\n";
						sql += ";select @@rowcount";
						if (startup.IsAdmin) sql = LinqSQLParser.RemapTenantToAdminSql(sql);
						sql = "set ansi_nulls off;" + sql;
						cmd.CommandText = sql;
						dc.Connection.Open();
						var startTime = DateTime.Now;
						object p = cmd.ExecuteScalar();
						var endTime = DateTime.Now;
						optimizer.TotalMilliseconds = (long)endTime.Subtract(startTime).TotalMilliseconds;
						dc.Connection.Close();
						return (int)p;
					}
				}
			}
		}

		#endregion

		#region UpdateData

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, int?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, int? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, int?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Single?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Single? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Single?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, decimal? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, decimal?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, double?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, double? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, double?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, short?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, short? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, short?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, string newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, string>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, string newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, string>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, string>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, string newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, string>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, DateTime? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, DateTime?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, bool? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, bool?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid? newValue)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connectionString">The database connection string</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid? newValue, string connectionString)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, connectionString);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		/// <summary>
		/// Update the specified field that matches the Where expression with the new data value
		/// </summary>
		/// <param name="select">The field to update</param>
		/// <param name="where">The expression that determines the records selected</param>
		/// <param name="newValue">The new value to set the specified field in all matching records</param>
		/// <param name="connection">An open database connection</param>
		/// <param name="transaction">The database connection transaction</param>
		/// <returns>The number of records affected</returns>
		public static int UpdateData(Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>> select, Expression<Func<Widgetsphere.Autos.EFDAL.DealerQuery, bool>> where, Guid? newValue, System.Data.IDbConnection connection, System.Data.Common.DbTransaction transaction)
		{
			return BusinessObjectQuery<Widgetsphere.Autos.EFDAL.Entity.Dealer, Widgetsphere.Autos.EFDAL.DealerQuery, Guid?>.UpdateData(select, where, newValue, "Dealer", GetDatabaseFieldName, true, null, connection, transaction);
		}

		#endregion

		#region GetDatabaseFieldName

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal static string GetDatabaseFieldName(Dealer.FieldNameConstants field)
		{
			return GetDatabaseFieldName(field.ToString());
		}

		/// <summary>
		/// Returns the actual database name of the specified field.
		/// </summary>
		internal new static string GetDatabaseFieldName(string field)
		{
			switch (field)
			{
				case "CompanyName": return "CompanyName";
				case "Directions": return "Directions";
				case "MetroId": return "MetroId";
				case "UserId": return "UserId";
				case "CreatedBy": return "CreatedBy";
				case "CreatedDate": return "CreatedDate";
				case "ModifiedBy": return "ModifiedBy";
				case "ModifiedDate": return "ModifiedDate";
				case "TimeStamp": return "TimeStamp";
			}
			return string.Empty;
		}

		#endregion

		#region Context

		AutosEntities IEntityWithContext.Context
		{
			get { return _internalContext; }
			set { _internalContext = value; }
		}
		private AutosEntities _internalContext = null;

		#endregion

		#region Auditing
		string nHydrate.EFCore.DataAccess.IAuditable.CreatedBy
		{
			get { return this.CreatedBy; }
		}

		System.DateTime? nHydrate.EFCore.DataAccess.IAuditable.CreatedDate
		{
			get { return this.CreatedDate; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsCreateAuditImplemented
		{
			get { return true; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsModifyAuditImplemented
		{
			get { return true; }
		}

		bool nHydrate.EFCore.DataAccess.IAuditable.IsTimestampAuditImplemented
		{
			get { return true; }
		}

		string nHydrate.EFCore.DataAccess.IAuditable.ModifiedBy
		{
			get { return this.ModifiedBy; }
		}

		System.DateTime? nHydrate.EFCore.DataAccess.IAuditable.ModifiedDate
		{
			get { return this.ModifiedDate; }
		}

		byte[] nHydrate.EFCore.DataAccess.IAuditable.TimeStamp
		{
			get { return this.TimeStamp; }
		}

		internal override void ResetModifiedBy(string modifier)
		{
			if (this.ModifiedBy != modifier)
				this.ModifiedBy = modifier;
		}

		internal override void ResetCreatedBy(string modifier)
		{
			if (this.CreatedBy != modifier)
				this.CreatedBy = modifier;
			this.ResetModifiedBy(modifier);
		}
		#endregion

		#region Equals
		/// <summary>
		/// Compares two objects of 'Dealer' type and determines if all properties match
		/// </summary>
		/// <returns>True if all properties match, false otherwise</returns>
		bool System.IEquatable<Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer>.Equals(Widgetsphere.Autos.EFDAL.Interfaces.Entity.IDealer other)
		{
			return this.Equals(other);
		}

		/// <summary>
		/// Compares two objects of 'Dealer' type and determines if all properties match
		/// </summary>
		/// <returns>True if all properties match, false otherwise</returns>
		public override bool Equals(object obj)
		{
			var other = obj as Widgetsphere.Autos.EFDAL.Entity.Dealer;
			if (other == null) return false;
			return (
				other.AcceptedAdvertTerms == this.AcceptedAdvertTerms &&
				other.Active == this.Active &&
				other.Address1 == this.Address1 &&
				other.Address2 == this.Address2 &&
				other.AlertFrequency == this.AlertFrequency &&
				other.AlertSent == this.AlertSent &&
				other.City == this.City &&
				other.CompanyName == this.CompanyName &&
				other.Description == this.Description &&
				other.Directions == this.Directions &&
				other.Email == this.Email &&
				other.FirstName == this.FirstName &&
				other.HomePhone == this.HomePhone &&
				other.LastName == this.LastName &&
				other.Latitude == this.Latitude &&
				other.Longitude == this.Longitude &&
				other.MetroId == this.MetroId &&
				other.MobilePhone == this.MobilePhone &&
				other.OfficeFax == this.OfficeFax &&
				other.OfficePhone == this.OfficePhone &&
				other.OfficePhoneExt == this.OfficePhoneExt &&
				other.Password == this.Password &&
				other.StateId == this.StateId &&
				other.UserId == this.UserId &&
				other.UserTypeId == this.UserTypeId &&
				other.ZipId == this.ZipId
				);
		}

		/// <summary>
		/// Serves as a hash function for this type.
		/// </summary>
		public override int GetHashCode()
		{
			return base.GetHashCode();
		}

		#endregion

		#region IDataErrorInfo
		/// <summary />
		string System.ComponentModel.IDataErrorInfo.Error
		{
			get { return this.GetObjectDataErrorInfo(); }
		}

		/// <summary />
		/// <param name="columnName"></param>
		/// <returns></returns>
		string System.ComponentModel.IDataErrorInfo.this[string columnName]
		{
			get
			{
				if (string.IsNullOrEmpty(columnName))
					return string.Empty;

				var retval = GetObjectPropertyDataErrorInfo(columnName);
				if (string.IsNullOrEmpty(retval))
				{
					switch (columnName.ToLower())
					{
						case "companyname":
							if (string.IsNullOrEmpty(this.CompanyName) || string.IsNullOrEmpty(this.CompanyName.Trim()))
								retval = "CompanyName is required!";
							break;
						default:
							break;
					}

				}
				return retval;
			}
		}
		#endregion

	}

}

